import Vue from "vue";
import App from "./App.vue";

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import router from './router/index.js'
import axios from 'axios'
import * as echarts from 'echarts'



// 拦截器
axios.interceptors.request.use(function (config) {
  // 在发送请求之前做些什么
  config.headers['Content-Type'] = 'application/json;charset=utf-8';
  // token验证
  var token=window.localStorage.getItem('token')
  // 如果存在token,每一个http请求都加上token
  config.headers.token = `${token}`;
  return config;
}, function (error) {
  // 对请求错误做些什么
  return Promise.reject(error);
});

Vue.prototype.$echarts = echarts
Vue.prototype.$axios = axios;
// Vue.use(axios)
Vue.use(ElementUI);
axios.defaults.baseURL = 'http://localhost:8088'
Vue.config.productionTip = false;

new Vue({
  render: (h) => h(App),
  router
}).$mount("#app");
